package mwn.droidbus.directions;

import mwn.droidbus.ui.*;
import android.graphics.*;

import com.google.android.maps.*;


// Draws one segment of the route - a straight line from two given points.
//used by Drawing class


public class DirectionsOverlay extends DroidOverlay{

	private GeoPoint startPt;
	private GeoPoint endPt;
	
	public DirectionsOverlay( GeoPoint p1 , GeoPoint p2 ) { // going to need to change droidoverlay (or this)
	    this.startPt = p1;
	    this.endPt = p2;
	}
	
	
	
	
	public boolean draw( Canvas canvas , MapView mapView , boolean shadow , long when ){
		super.draw( canvas , mapView , shadow , when );
	    Projection proj = mapView.getProjection();	   
	    Paint paint = new Paint();
	    paint.setStrokeWidth(4f); 
		paint.setStyle( Paint.Style.STROKE );
		paint.setStrokeJoin( Paint.Join.ROUND );	 
	    
	    Point p1 = new Point();
	    proj.toPixels( startPt , p1 );
        Point p2 = new Point();
        proj.toPixels( endPt , p2 );
        
        paint.setColor( Color.RED );
	        
	    canvas.drawLine( p1.x , p1.y , p2.x , p2.y , paint );        
	
	   return true;
	}//draw
	
}//class
